package com.camerareader.common;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;
import android.widget.ProgressBar;

import com.camerareader.R;

/**
 * Created by Administrator on 2016-12-09.
 */

public class ProgressWindow extends PopupWindow {
    private ProgressBar progressBar;
    public ProgressWindow(Context context) {
        super(context);
        initView(context);
    }

    private void initView(Context context) {
        View view = LayoutInflater.from(context).inflate(R.layout.progress_layout, null);
        progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
        setContentView(view);
        setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
        setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
        setOutsideTouchable(false);
    }


    public void setProgress(int progress, int total){
        progressBar.setProgress(progress + 1);
        progressBar.setMax(total);
    }
}
